package com.example.reference_book.controller;

import com.example.reference_book.entity.Book;
import com.example.reference_book.entity.Course;
import com.example.reference_book.service.BookService;
import com.example.reference_book.service.CourseService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("searchBookNameStrategy")
public class searchBookNameStrategy implements BookStrategy {

    @Resource
    private BookService bookService;

    @GetMapping("/{type}/{key}")
    public List<Book> searchByType(@PathVariable("type") String type, @PathVariable("key") String key) {
//        System.out.println("search---1");
        return this.bookService.queryByName(type,key);
    }
}
